Skip to content

Update createSessionKey function parameters #7582

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 7 commits into
base: main
Choose a base branch
from

Conversation

0xFirekeeper
Copy link
Member

@0xFirekeeper 0xFirekeeper commented Jul 10, 2025

<!--

## title your PR with this format: "[SDK/Dashboard/Portal] Feature/Fix: Concise title for the changes"

[SDK] Fix: Simplify `createSessionKey` API by inferring contract

If you did not copy the branch name from Linear, paste the issue tag here (format is TEAM-0000):

## Notes for the reviewer

The `createSessionKey` function no longer requires a `contract` object as input. The contract is now internally created using `account.address` and the `MinimalAccountAbi`, streamlining the API for its specific use case.

## How to test

Run unit tests for `sessionkey.test.ts`.

-->

Slack Thread


PR-Codex overview

This PR focuses on refactoring the createSessionKey function in the thirdweb library to enhance its design by removing the contract parameter, simplifying its usage, and ensuring it maintains existing functionality.

Detailed summary

  • Removed contract input parameter from createSessionKey function.
  • Function now internally recreates the contract using account.address and auto-resolved ABI.
  • Updated function signature to accept client and chain directly.
  • Adjusted related session key tests to align with the new signature.
  • Simplified implementation while preserving functionality.

✨ Ask PR-Codex anything about this PR by commenting with /codex {your question}

Summary by CodeRabbit

  • Refactor

    • Simplified session key creation by automatically handling contract instantiation based on provided account address, client, and chain.
    • Updated options for session key creation to require client and chain parameters, removing the need for a contract parameter.
    • Adjusted documentation and examples to reflect these changes.
  • Tests

    • Updated tests to use the new session key creation parameters and flow.

cursoragent and others added 3 commits July 10, 2025 14:17
- Remove contract input parameter from createSessionKey function
- Recreate contract internally using account.address and MinimalAccount ABI
- Update function signature to take client and chain directly
- Update tests to use new function signature
- Set ABI to MinimalAccount contract ABI as specified
- Remove unused accountContract variable from test file
- Remove unused import for ThirdwebContract
- Organize imports in correct order
Co-authored-by: firekeeper <firekeeper@thirdweb.com>
@0xFirekeeper 0xFirekeeper requested review from a team as code owners July 10, 2025 14:32
Copy link

changeset-bot bot commented Jul 10, 2025

🦋 Changeset detected

Latest commit: 870e235

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 3 packages
Name Type
thirdweb Patch
@thirdweb-dev/nebula Patch
@thirdweb-dev/wagmi-adapter Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

Copy link
Contributor

coderabbitai bot commented Jul 10, 2025

"""

Walkthrough

The createSessionKey function was refactored to internally instantiate the contract using a new MinimalAccountAbi and the provided client and chain parameters, eliminating the need for an explicit contract parameter. The asynchronous signature generation step was removed, and the session specification construction was simplified. Corresponding changes were made to the function's options type and its usage in test cases. The helper function isCreateSessionKeySupported was retained but its documentation was corrected.

Changes

File(s) Change Summary
.../erc7702/account/createSessionKey.ts Refactored createSessionKey to internally instantiate contract using client, chain, and new ABI. Removed async signature generation and simplified session spec construction. Updated options type and JSDoc. Corrected isCreateSessionKeySupported docs.
.../erc7702/account/sessionkey.test.ts Updated tests to remove contract instantiation; now pass client and chain to createSessionKey.
.changeset/refactor-create-session-key-parameters.md Documented removal of contract parameter from createSessionKey and update to accept client and chain.

Sequence Diagram(s)

sequenceDiagram
    participant Caller
    participant createSessionKey
    participant getContract
    participant MinimalAccountContract

    Caller->>createSessionKey: Call with {account, client, chain, ...}
    createSessionKey->>getContract: Instantiate contract with account.address, chain, client, MinimalAccountAbi
    getContract-->>createSessionKey: Return MinimalAccountContract
    createSessionKey->>MinimalAccountContract: Call createSessionWithSig with sessionSpec and empty signature
    createSessionKey-->>Caller: Return prepared transaction
Loading

"""

Warning

Review ran into problems

🔥 Problems

Errors were encountered while retrieving linked issues.

Errors (1)
  • TEAM-0000: Entity not found: Issue - Could not find referenced Issue.

📜 Recent review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 2d90dd4 and 870e235.

📒 Files selected for processing (1)
  • packages/thirdweb/src/extensions/erc7702/account/createSessionKey.ts (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • packages/thirdweb/src/extensions/erc7702/account/createSessionKey.ts
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (8)
  • GitHub Check: Build Packages
  • GitHub Check: Unit Tests
  • GitHub Check: E2E Tests (pnpm, webpack)
  • GitHub Check: E2E Tests (pnpm, vite)
  • GitHub Check: E2E Tests (pnpm, esbuild)
  • GitHub Check: Lint Packages
  • GitHub Check: Size
  • GitHub Check: Analyze (javascript)
✨ Finishing Touches
  • 📝 Generate Docstrings

🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link
Contributor

graphite-app bot commented Jul 10, 2025

How to use the Graphite Merge Queue

Add either label to this PR to merge it via the merge queue:

  • merge-queue - adds this PR to the back of the merge queue
  • hotfix - for urgent hot fixes, skip the queue and merge this PR next

You must have a Graphite account in order to use the merge queue. Sign up using this link.

An organization admin has enabled the Graphite Merge Queue in this repository.

Please do not merge from GitHub as this will restart CI on PRs being processed by the merge queue.

@github-actions github-actions bot added packages SDK Involves changes to the thirdweb SDK labels Jul 10, 2025
Copy link

vercel bot commented Jul 10, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
docs-v2 ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jul 10, 2025 6:06pm
nebula ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jul 10, 2025 6:06pm
thirdweb_playground ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jul 10, 2025 6:06pm
thirdweb-www ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jul 10, 2025 6:06pm
wallet-ui ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jul 10, 2025 6:06pm

This project uses pnpm, not npm. The package-lock.json was
accidentally created and should not exist in this repository.
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

🧹 Nitpick comments (1)
packages/thirdweb/src/extensions/erc7702/account/createSessionKey.ts (1)

21-47: Consider extracting the ABI to a separate file for maintainability.

The MinimalAccountAbi constant is quite large (27 lines) and defined inline. This could impact code readability and maintainability.

Consider extracting this to a separate file like MinimalAccountAbi.ts:

+// Create packages/thirdweb/src/extensions/erc7702/account/MinimalAccountAbi.ts
+export const MinimalAccountAbi = [
+  // ... ABI definition
+] as const;

Then import it:

-// MinimalAccount ABI - using the ABI definition from the JSON file
-const MinimalAccountAbi = [
-  "error AllowanceExceeded(uint256 allowanceUsage, uint256 limit, uint64 period)",
-  // ... rest of ABI
-] as const;
+import { MinimalAccountAbi } from "./MinimalAccountAbi.js";
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between bd395a3 and e1e9ff8.

⛔ Files ignored due to path filters (1)
  • package-lock.json is excluded by !**/package-lock.json
📒 Files selected for processing (2)
  • packages/thirdweb/src/extensions/erc7702/account/createSessionKey.ts (5 hunks)
  • packages/thirdweb/src/extensions/erc7702/account/sessionkey.test.ts (2 hunks)
🧰 Additional context used
📓 Path-based instructions (2)
`**/*.{ts,tsx}`: Write idiomatic TypeScript with explicit function declarations ...

**/*.{ts,tsx}: Write idiomatic TypeScript with explicit function declarations and return types
Limit each file to one stateless, single-responsibility function for clarity
Re-use shared types from @/types or local types.ts barrels
Prefer type aliases over interface except for nominal shapes
Avoid any and unknown unless unavoidable; narrow generics when possible
Choose composition over inheritance; leverage utility types (Partial, Pick, etc.)
Comment only ambiguous logic; avoid restating TypeScript in prose
Load heavy dependencies inside async paths to keep initial bundle lean (lazy loading)

📄 Source: CodeRabbit Inference Engine (CLAUDE.md)

List of files the instruction was applied to:

  • packages/thirdweb/src/extensions/erc7702/account/sessionkey.test.ts
  • packages/thirdweb/src/extensions/erc7702/account/createSessionKey.ts
`**/*.test.{ts,tsx}`: Place tests alongside code: `foo.ts` ↔ `foo.test.ts` Use r...

**/*.test.{ts,tsx}: Place tests alongside code: foo.tsfoo.test.ts
Use real function invocations with stub data in tests; avoid brittle mocks
Use Mock Service Worker (MSW) for fetch/HTTP call interception in tests
Keep tests deterministic and side-effect free
Use FORKED_ETHEREUM_CHAIN for mainnet interactions and ANVIL_CHAIN for isolated tests

📄 Source: CodeRabbit Inference Engine (CLAUDE.md)

List of files the instruction was applied to:

  • packages/thirdweb/src/extensions/erc7702/account/sessionkey.test.ts
🧠 Learnings (3)
📓 Common learnings
Learnt from: CR
PR: thirdweb-dev/js#0
File: CLAUDE.md:0-0
Timestamp: 2025-06-30T10:25:29.489Z
Learning: Applies to src/wallets/**/*.{ts,tsx} : Smart wallets with account abstraction in wallet architecture
Learnt from: CR
PR: thirdweb-dev/js#0
File: CLAUDE.md:0-0
Timestamp: 2025-06-30T10:25:29.489Z
Learning: Applies to src/wallets/**/*.{ts,tsx} : Unified `Wallet` and `Account` interfaces in wallet architecture
Learnt from: CR
PR: thirdweb-dev/js#0
File: CLAUDE.md:0-0
Timestamp: 2025-06-30T10:25:29.489Z
Learning: Applies to src/wallets/**/*.{ts,tsx} : Support EIP-1193, EIP-5792, EIP-7702 standards in wallet architecture
Learnt from: CR
PR: thirdweb-dev/js#0
File: CLAUDE.md:0-0
Timestamp: 2025-06-30T10:25:29.489Z
Learning: Applies to src/extensions/**/*.{ts,tsx} : Auto-generated contracts from ABI definitions in extensions
Learnt from: MananTank
PR: thirdweb-dev/js#7332
File: apps/dashboard/src/app/(app)/(dashboard)/(chain)/[chain_id]/[contractAddress]/public-pages/nft/overview/nft-drop-claim.tsx:82-90
Timestamp: 2025-06-13T13:03:41.732Z
Learning: The thirdweb `contract` object is serializable and can safely be used in contexts (e.g., React-Query keys) that require serializable values.
Learnt from: CR
PR: thirdweb-dev/js#0
File: CLAUDE.md:0-0
Timestamp: 2025-06-30T10:25:29.489Z
Learning: Applies to src/wallets/**/*.{ts,tsx} : Support for in-app wallets (social/email login) in wallet architecture
packages/thirdweb/src/extensions/erc7702/account/sessionkey.test.ts (12)
Learnt from: CR
PR: thirdweb-dev/js#0
File: CLAUDE.md:0-0
Timestamp: 2025-06-30T10:25:29.488Z
Learning: Applies to test/src/test-wallets.ts : Predefined test accounts are in `test/src/test-wallets.ts`
Learnt from: CR
PR: thirdweb-dev/js#0
File: CLAUDE.md:0-0
Timestamp: 2025-06-30T10:25:29.489Z
Learning: Applies to src/wallets/**/*.{ts,tsx} : Smart wallets with account abstraction in wallet architecture
Learnt from: CR
PR: thirdweb-dev/js#0
File: CLAUDE.md:0-0
Timestamp: 2025-06-30T10:25:29.489Z
Learning: Applies to src/wallets/**/*.{ts,tsx} : Unified `Wallet` and `Account` interfaces in wallet architecture
Learnt from: CR
PR: thirdweb-dev/js#0
File: CLAUDE.md:0-0
Timestamp: 2025-06-30T10:25:29.489Z
Learning: Applies to src/extensions/**/*.{ts,tsx} : Auto-generated contracts from ABI definitions in extensions
Learnt from: CR
PR: thirdweb-dev/js#0
File: CLAUDE.md:0-0
Timestamp: 2025-06-30T10:25:29.489Z
Learning: Applies to src/wallets/**/*.{ts,tsx} : Support EIP-1193, EIP-5792, EIP-7702 standards in wallet architecture
Learnt from: CR
PR: thirdweb-dev/js#0
File: CLAUDE.md:0-0
Timestamp: 2025-06-30T10:25:29.488Z
Learning: Applies to **/*.test.{ts,tsx} : Use `FORKED_ETHEREUM_CHAIN` for mainnet interactions and `ANVIL_CHAIN` for isolated tests
Learnt from: CR
PR: thirdweb-dev/js#0
File: CLAUDE.md:0-0
Timestamp: 2025-06-30T10:25:29.489Z
Learning: Applies to src/wallets/**/*.{ts,tsx} : Support for in-app wallets (social/email login) in wallet architecture
Learnt from: CR
PR: thirdweb-dev/js#0
File: CLAUDE.md:0-0
Timestamp: 2025-06-30T10:25:29.488Z
Learning: Applies to **/*.test.{ts,tsx} : Keep tests deterministic and side-effect free
Learnt from: MananTank
PR: thirdweb-dev/js#7332
File: apps/dashboard/src/app/(app)/(dashboard)/(chain)/[chain_id]/[contractAddress]/public-pages/nft/overview/nft-drop-claim.tsx:82-90
Timestamp: 2025-06-13T13:03:41.732Z
Learning: The thirdweb `contract` object is serializable and can safely be used in contexts (e.g., React-Query keys) that require serializable values.
Learnt from: MananTank
PR: thirdweb-dev/js#7227
File: apps/dashboard/src/app/(app)/(dashboard)/(chain)/[chain_id]/[contractAddress]/modules/components/OpenEditionMetadata.tsx:26-26
Timestamp: 2025-05-30T17:14:25.332Z
Learning: The ModuleCardUIProps interface already includes a client prop of type ThirdwebClient, so when components use `Omit<ModuleCardUIProps, "children" | "updateButton">`, they inherit the client prop without needing to add it explicitly.
Learnt from: CR
PR: thirdweb-dev/js#0
File: .cursor/rules/dashboard.mdc:0-0
Timestamp: 2025-06-30T10:26:04.389Z
Learning: Applies to dashboard/**/components/*.client.tsx : Client components must start with `'use client';` before imports.
Learnt from: MananTank
PR: thirdweb-dev/js#7298
File: apps/dashboard/src/app/nebula-app/move-funds/move-funds.tsx:424-424
Timestamp: 2025-06-06T23:46:08.795Z
Learning: The thirdweb project has an ESLint rule that restricts direct usage of `defineChain`. When it's necessary to use `defineChain` directly, it's acceptable to disable the rule with `// eslint-disable-next-line no-restricted-syntax`.
packages/thirdweb/src/extensions/erc7702/account/createSessionKey.ts (10)
Learnt from: CR
PR: thirdweb-dev/js#0
File: CLAUDE.md:0-0
Timestamp: 2025-06-30T10:25:29.489Z
Learning: Applies to src/wallets/**/*.{ts,tsx} : Smart wallets with account abstraction in wallet architecture
Learnt from: CR
PR: thirdweb-dev/js#0
File: CLAUDE.md:0-0
Timestamp: 2025-06-30T10:25:29.489Z
Learning: Applies to src/wallets/**/*.{ts,tsx} : Unified `Wallet` and `Account` interfaces in wallet architecture
Learnt from: CR
PR: thirdweb-dev/js#0
File: CLAUDE.md:0-0
Timestamp: 2025-06-30T10:25:29.489Z
Learning: Applies to src/extensions/**/*.{ts,tsx} : Auto-generated contracts from ABI definitions in extensions
Learnt from: CR
PR: thirdweb-dev/js#0
File: CLAUDE.md:0-0
Timestamp: 2025-06-30T10:25:29.489Z
Learning: Applies to src/wallets/**/*.{ts,tsx} : Support EIP-1193, EIP-5792, EIP-7702 standards in wallet architecture
Learnt from: CR
PR: thirdweb-dev/js#0
File: CLAUDE.md:0-0
Timestamp: 2025-06-30T10:25:29.488Z
Learning: Applies to **/*.test.{ts,tsx} : Use `FORKED_ETHEREUM_CHAIN` for mainnet interactions and `ANVIL_CHAIN` for isolated tests
Learnt from: CR
PR: thirdweb-dev/js#0
File: CLAUDE.md:0-0
Timestamp: 2025-06-30T10:25:29.488Z
Learning: Applies to test/src/test-wallets.ts : Predefined test accounts are in `test/src/test-wallets.ts`
Learnt from: MananTank
PR: thirdweb-dev/js#7332
File: apps/dashboard/src/app/(app)/(dashboard)/(chain)/[chain_id]/[contractAddress]/public-pages/nft/overview/nft-drop-claim.tsx:82-90
Timestamp: 2025-06-13T13:03:41.732Z
Learning: The thirdweb `contract` object is serializable and can safely be used in contexts (e.g., React-Query keys) that require serializable values.
Learnt from: MananTank
PR: thirdweb-dev/js#7298
File: apps/dashboard/src/app/nebula-app/move-funds/move-funds.tsx:424-424
Timestamp: 2025-06-06T23:46:08.795Z
Learning: The thirdweb project has an ESLint rule that restricts direct usage of `defineChain`. When it's necessary to use `defineChain` directly, it's acceptable to disable the rule with `// eslint-disable-next-line no-restricted-syntax`.
Learnt from: CR
PR: thirdweb-dev/js#0
File: CLAUDE.md:0-0
Timestamp: 2025-06-30T10:25:29.489Z
Learning: Applies to src/wallets/**/*.{ts,tsx} : Support for in-app wallets (social/email login) in wallet architecture
Learnt from: MananTank
PR: thirdweb-dev/js#7356
File: apps/nebula/src/app/not-found.tsx:1-1
Timestamp: 2025-06-17T18:30:52.976Z
Learning: In the thirdweb/js project, the React namespace is available for type annotations (like React.FC) without needing to explicitly import React. This is project-specific configuration that differs from typical TypeScript/React setups.
🧬 Code Graph Analysis (1)
packages/thirdweb/src/extensions/erc7702/account/createSessionKey.ts (3)
packages/thirdweb/src/exports/wallets/in-app.native.ts (2)
  • CreateSessionKeyOptions (5-5)
  • createSessionKey (6-6)
packages/thirdweb/src/exports/wallets/in-app.ts (2)
  • CreateSessionKeyOptions (5-5)
  • createSessionKey (6-6)
packages/thirdweb/src/exports/thirdweb.ts (1)
  • getContract (43-43)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (8)
  • GitHub Check: E2E Tests (pnpm, webpack)
  • GitHub Check: Size
  • GitHub Check: E2E Tests (pnpm, vite)
  • GitHub Check: Build Packages
  • GitHub Check: E2E Tests (pnpm, esbuild)
  • GitHub Check: Unit Tests
  • GitHub Check: Lint Packages
  • GitHub Check: Analyze (javascript)
🔇 Additional comments (6)
packages/thirdweb/src/extensions/erc7702/account/sessionkey.test.ts (2)

55-56: LGTM! Test updated correctly for the new API.

The test correctly passes client and chain parameters to match the simplified createSessionKey API.


74-75: LGTM! Consistent with the API change.

The second test case is updated consistently with the first one, properly using the new API signature.

packages/thirdweb/src/extensions/erc7702/account/createSessionKey.ts (4)

1-3: LGTM! Appropriate imports for the new functionality.

The added imports for Chain, ThirdwebClient, and getContract are necessary for the internal contract creation feature.


53-60: LGTM! Type definition correctly updated for the new API.

The addition of client and chain parameters to CreateSessionKeyOptions properly reflects the new internal contract creation approach.


97-98: LGTM! Example documentation updated to reflect the new API.

The example correctly shows the simplified API without needing to pass a contract instance.


109-131: LGTM! Internal contract creation logic is correct.

The function now properly creates the contract internally using the provided client, chain, and account.address. The destructuring and contract creation logic look correct.

@vercel vercel bot temporarily deployed to Preview – wallet-ui July 10, 2025 14:35 Inactive
@vercel vercel bot temporarily deployed to Preview – docs-v2 July 10, 2025 14:35 Inactive
@vercel vercel bot temporarily deployed to Preview – nebula July 10, 2025 14:35 Inactive
@vercel vercel bot temporarily deployed to Preview – thirdweb-www July 10, 2025 14:36 Inactive
@vercel vercel bot temporarily deployed to Preview – thirdweb_playground July 10, 2025 14:36 Inactive
Co-authored-by: firekeeper <firekeeper@thirdweb.com>
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

🧹 Nitpick comments (1)
.changeset/refactor-create-session-key-parameters.md (1)

5-5: Fix markdown formatting: Use proper heading instead of emphasis.

The line uses emphasis (**bold**) instead of a proper heading. This should be formatted as a heading for better document structure.

-**Refactor createSessionKey function to remove contract parameter**
+# Refactor createSessionKey function to remove contract parameter
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between e1e9ff8 and 70fb23c.

📒 Files selected for processing (2)
  • .changeset/refactor-create-session-key-parameters.md (1 hunks)
  • packages/thirdweb/src/extensions/erc7702/account/createSessionKey.ts (1 hunks)
🧰 Additional context used
📓 Path-based instructions (1)
`**/*.{ts,tsx}`: Write idiomatic TypeScript with explicit function declarations ...

**/*.{ts,tsx}: Write idiomatic TypeScript with explicit function declarations and return types
Limit each file to one stateless, single-responsibility function for clarity
Re-use shared types from @/types or local types.ts barrels
Prefer type aliases over interface except for nominal shapes
Avoid any and unknown unless unavoidable; narrow generics when possible
Choose composition over inheritance; leverage utility types (Partial, Pick, etc.)
Comment only ambiguous logic; avoid restating TypeScript in prose
Load heavy dependencies inside async paths to keep initial bundle lean (lazy loading)

📄 Source: CodeRabbit Inference Engine (CLAUDE.md)

List of files the instruction was applied to:

  • packages/thirdweb/src/extensions/erc7702/account/createSessionKey.ts
🧠 Learnings (3)
📓 Common learnings
Learnt from: CR
PR: thirdweb-dev/js#0
File: CLAUDE.md:0-0
Timestamp: 2025-06-30T10:25:29.489Z
Learning: Applies to src/wallets/**/*.{ts,tsx} : Smart wallets with account abstraction in wallet architecture
Learnt from: CR
PR: thirdweb-dev/js#0
File: CLAUDE.md:0-0
Timestamp: 2025-06-30T10:25:29.489Z
Learning: Applies to src/wallets/**/*.{ts,tsx} : Unified `Wallet` and `Account` interfaces in wallet architecture
Learnt from: CR
PR: thirdweb-dev/js#0
File: CLAUDE.md:0-0
Timestamp: 2025-06-30T10:25:29.489Z
Learning: Applies to src/wallets/**/*.{ts,tsx} : Support EIP-1193, EIP-5792, EIP-7702 standards in wallet architecture
Learnt from: CR
PR: thirdweb-dev/js#0
File: CLAUDE.md:0-0
Timestamp: 2025-06-30T10:25:29.489Z
Learning: Applies to src/extensions/**/*.{ts,tsx} : Auto-generated contracts from ABI definitions in extensions
.changeset/refactor-create-session-key-parameters.md (6)
Learnt from: CR
PR: thirdweb-dev/js#0
File: CLAUDE.md:0-0
Timestamp: 2025-06-30T10:25:29.489Z
Learning: Applies to src/wallets/**/*.{ts,tsx} : Smart wallets with account abstraction in wallet architecture
Learnt from: CR
PR: thirdweb-dev/js#0
File: CLAUDE.md:0-0
Timestamp: 2025-06-30T10:25:29.489Z
Learning: Applies to src/wallets/**/*.{ts,tsx} : Unified `Wallet` and `Account` interfaces in wallet architecture
Learnt from: CR
PR: thirdweb-dev/js#0
File: CLAUDE.md:0-0
Timestamp: 2025-06-30T10:25:29.489Z
Learning: Applies to src/extensions/**/*.{ts,tsx} : Auto-generated contracts from ABI definitions in extensions
Learnt from: CR
PR: thirdweb-dev/js#0
File: CLAUDE.md:0-0
Timestamp: 2025-06-30T10:25:29.489Z
Learning: Applies to src/wallets/**/*.{ts,tsx} : Support EIP-1193, EIP-5792, EIP-7702 standards in wallet architecture
Learnt from: MananTank
PR: thirdweb-dev/js#7332
File: apps/dashboard/src/app/(app)/(dashboard)/(chain)/[chain_id]/[contractAddress]/public-pages/nft/overview/nft-drop-claim.tsx:82-90
Timestamp: 2025-06-13T13:03:41.732Z
Learning: The thirdweb `contract` object is serializable and can safely be used in contexts (e.g., React-Query keys) that require serializable values.
Learnt from: CR
PR: thirdweb-dev/js#0
File: CLAUDE.md:0-0
Timestamp: 2025-06-30T10:25:29.489Z
Learning: Applies to src/wallets/**/*.{ts,tsx} : Support for in-app wallets (social/email login) in wallet architecture
packages/thirdweb/src/extensions/erc7702/account/createSessionKey.ts (5)
Learnt from: CR
PR: thirdweb-dev/js#0
File: CLAUDE.md:0-0
Timestamp: 2025-06-30T10:25:29.489Z
Learning: Applies to src/wallets/**/*.{ts,tsx} : Unified `Wallet` and `Account` interfaces in wallet architecture
Learnt from: CR
PR: thirdweb-dev/js#0
File: CLAUDE.md:0-0
Timestamp: 2025-06-30T10:25:29.489Z
Learning: Applies to src/wallets/**/*.{ts,tsx} : Smart wallets with account abstraction in wallet architecture
Learnt from: CR
PR: thirdweb-dev/js#0
File: CLAUDE.md:0-0
Timestamp: 2025-06-30T10:25:29.489Z
Learning: Applies to src/wallets/**/*.{ts,tsx} : Support EIP-1193, EIP-5792, EIP-7702 standards in wallet architecture
Learnt from: CR
PR: thirdweb-dev/js#0
File: CLAUDE.md:0-0
Timestamp: 2025-06-30T10:25:29.489Z
Learning: Applies to src/extensions/**/*.{ts,tsx} : Auto-generated contracts from ABI definitions in extensions
Learnt from: CR
PR: thirdweb-dev/js#0
File: CLAUDE.md:0-0
Timestamp: 2025-06-30T10:25:29.489Z
Learning: Applies to src/wallets/**/*.{ts,tsx} : Support for in-app wallets (social/email login) in wallet architecture
🪛 markdownlint-cli2 (0.17.2)
.changeset/refactor-create-session-key-parameters.md

5-5: Emphasis used instead of a heading

(MD036, no-emphasis-as-heading)

⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (8)
  • GitHub Check: E2E Tests (pnpm, vite)
  • GitHub Check: E2E Tests (pnpm, webpack)
  • GitHub Check: E2E Tests (pnpm, esbuild)
  • GitHub Check: Unit Tests
  • GitHub Check: Size
  • GitHub Check: Lint Packages
  • GitHub Check: Build Packages
  • GitHub Check: Analyze (javascript)
🔇 Additional comments (8)
packages/thirdweb/src/extensions/erc7702/account/createSessionKey.ts (7)

1-3: LGTM: Clean import additions for internal contract creation.

The new imports are well-organized and necessary for the refactored implementation that internally creates the contract instance.


12-21: LGTM: Type definition properly updated for simplified API.

The CreateSessionKeyOptions type correctly includes the new client and chain parameters needed for internal contract creation, with appropriate optional parameter defaults.


24-44: LGTM: Documentation updated to reflect simplified API.

The documentation and example correctly demonstrate the new function signature without the contract parameter, making the API usage clearer.


64-103: LGTM: Session specification construction is well-structured.

The direct construction of sessionSpec with default values and proper type mapping is clean and maintainable. The logic correctly handles both wildcard permissions and specific policies.


124-126: LGTM: Helper function correctly delegates to underlying implementation.

The isCreateSessionKeySupported function appropriately delegates to isCreateSessionWithSigSupported, maintaining consistency with the main function's implementation.


105-110: Empty signature is forwarded as-is
The SDK wrapper doesn’t apply any special handling to the signature field—it simply sends the literal string "0x" (a zero-length bytes) in the contract call. Please confirm that your ERC-7702 contract’s createSessionWithSig implementation accepts an empty signature for session-key delegation.

• Location in source:
packages/thirdweb/src/extensions/erc7702/account/createSessionKey.ts (≈ lines 105–110)

return createSessionWithSig({
  contract,
  sessionSpec,
  signature: "0x",
});

• Generated wrapper passes the signature unchanged:
packages/thirdweb/src/extensions/erc7702/generated/MinimalAccount/write/createSessionWithSig.ts

params: async () => {
  const { sessionSpec, signature } = await asyncOptions();
  return [sessionSpec, signature] as const;
}

57-62: ABI is provided by the ERC-7702 extension’s generated code
The call to getContract({ address, chain, client }) simply returns a base contract wrapper. The actual ABI for createSessionWithSig is imported from
packages/thirdweb/src/extensions/erc7702/account/generated/MinimalAccount/write/createSessionWithSig.js
so no explicit abi parameter is required when creating the contract here. All supported minimal‐account implementations will work as expected.

.changeset/refactor-create-session-key-parameters.md (1)

7-11: LGTM: Changeset accurately describes the refactor.

The changeset properly documents all the key changes made to the createSessionKey function and related components.

Copy link
Contributor

github-actions bot commented Jul 10, 2025

size-limit report 📦

Path Size Loading time (3g) Running time (snapdragon) Total time
thirdweb (esm) 63.2 KB (0%) 1.3 s (0%) 700 ms (+73.31% 🔺) 2 s
thirdweb (cjs) 353.26 KB (0%) 7.1 s (0%) 3 s (+4.79% 🔺) 10.1 s
thirdweb (minimal + tree-shaking) 5.7 KB (0%) 114 ms (0%) 288 ms (+1314.62% 🔺) 402 ms
thirdweb/chains (tree-shaking) 526 B (0%) 11 ms (0%) 46 ms (+440.01% 🔺) 56 ms
thirdweb/react (minimal + tree-shaking) 19.59 KB (0%) 392 ms (0%) 132 ms (+150.83% 🔺) 524 ms

Co-authored-by: firekeeper <firekeeper@thirdweb.com>
Co-authored-by: firekeeper <firekeeper@thirdweb.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
DO NOT MERGE This pull request is still in progress and is not ready to be merged. packages SDK Involves changes to the thirdweb SDK
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants